package com.cashmama.market.api.application.controller.order.request;

import com.cashmama.market.api.infras.exception.ApplicationException;
import com.cashmama.market.api.infras.utils.StringUtils;
import com.fqgj.common.api.ParamsObject;

/**
 * @program: market-api
 * @description 订单确认参数
 * @author: frank
 * @create: 2019-12-24 17:28
 **/
public class OrderConfirmRequest extends ParamsObject {

    private String productCode;
    private String merchantCode;

    public String getProductCode() {
        return productCode;
    }

    public OrderConfirmRequest setProductCode(String productCode) {
        this.productCode = productCode;
        return this;
    }

    public String getMerchantCode() {
        return merchantCode;
    }

    public OrderConfirmRequest setMerchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
        return this;
    }

    @Override
    public void validate() {
        if(StringUtils.isEmpty(productCode)){
            throw new ApplicationException("productCode can't be null");
        }
        if(StringUtils.isEmpty(merchantCode)){
            throw new ApplicationException("merchantCode can't be null");
        }
    }
}
